Dynamic List Widget
A Widget for displaying a list of Entry that supports dynamic operations and entry features.
Entries can have different heights
Entries can be hidden and unhidden
Built-in entry text searching capabilities
Add or remove entries (as of 0.6.5)
Scrollable, navigable, narratable, and everything else expected from a vanilla list.
Author
fzzyhmstrs
Since
0.6.0
Parameters
MinecraftClient instance
List<BiFunction
horizontal position of the left edge of the widget in pixels
vertical position of the top edge of the widget in pixels
width of the widget in pixels
height of the widget in pixels
ListSpec widget options for customizing list visuals and behavior.
Constructors
Types
Base entry class for list widget entries. This is typically built using a BiFunction that supplies the parentElement and an entry index
Feature configuration spec for a Dynamic List
Enum defining how the user sees and can interact with an entry.
Returns a Visibility for a consumer of an entries Visibility. Visibility itself is a visibility provider, returning itself. This is to lower the memory footprint of the entries if, as is typical, they are only ever one visibility (usually Visibility.VISIBLE). If visibility is modified during usage, the default visibility provider enum is replaced with a VisibilityStack to track visibility changes over time.
A VisibilityProvider that tracks the base visibility of an entry as well as the entries visibility history through a stack (linked list).
Properties
Functions
Adds an entry at the end of the entries list.
Adds an entry after the specified existing entry in the entries list.
Adds an entry before the specified existing entry in the entries list.
The length in pixels that the bottom of the list is out of frame below the bottom of the widget.
The height of the entries in the list. If the list contains twenty 20px entries, content height is 400
Ensures that the provided entry is in frame. Implementations should scroll as needed to fully incorporate the entry into the widget frame.
The entry underneath the mouse, if any.
Return a navigation path leading through this list and to an entry, as applicable. The default implementation will likely not function properly; see DynamicListWidget for an example implementation
Handle a context event. This will be triggered by a parent, typically on key press or mouse click. A parent object can of course also be a context handler, handle context as applicable and then pass the event downstream for further handling.
Handles a scroll input. This is scroll from a mouse, so the input should be multiplied by a factor to make scroll distance reasonable.
Handles "direct" scroll input. This amount is not scaled, so the amount input should be the amount scrolled.
Whether the scroll bar should not render if the widget isn't hovered. Default false.
Entries that are currently visible in the list frame. These entries will be rendered as applicable. Entries partially in frame should be included.
This is run when the widget is moved or resized. List elements should be repositioned when this is called.
Indicates that the overlay has been removed and the parent should return focus to the cached element, if any, in lastSelected
Add a set of grouped context action builders to a result
Indicates to the parent element to cache it's current focused element. The current focused element should be stored in lastSelected
Removes an entry from this list widget if it exists in the entries list. Will remove all instances of it if more than one instance of the same object reference are included in the list.
When called the parent element should reselect a hovered element based on the supplied mouse positions, if it tracks such things
Scroll to the bottom of the list content. bottomDelta should be 0 or negative after this scroll
Scroll to the top of the list content. topDelta should be 0 after this scroll.
List entries tht are currently selectable. Hidden or otherwise disabled entries should not be counted in this list.